﻿
#region Copyright & License
// --------------------------
// Copyright 2008 Daniel Gray
// --------------------------
// This file is part of Kale.
//
// Kale is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Kale is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with Kale.  If not, see <http://www.gnu.org/licenses/>.
#endregion
#region File details
// --------------------------------------------------------
// Filename          : NodeCachingElement.cs
// Author            : Daniel Gray
// Created           : 15/04/2008
// --------------------------------------------------------
#endregion
            
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using System.Web.Caching;

namespace Kale.Core.Configuration
{
   /// <summary>
   /// Represents the configuration for node caching.
   /// </summary>
   public class NodeCachingElement : ConfigurationElement
   {
      /// <summary>
      /// Gets or sets the type of the node cache.
      /// </summary>
      /// <value>The type of the node cache.</value>
      [ConfigurationProperty("type", IsRequired = false, DefaultValue = NodeCacheType.None)]
      public NodeCacheType Type
      {
         get { return (NodeCacheType)this["type"]; }
         set { this["type"] = value; }
      }

      /// <summary>
      /// Gets or sets the priority.
      /// </summary>
      /// <value>The priority.</value>
      [ConfigurationProperty("priority", IsRequired = false, DefaultValue = CacheItemPriority.Normal)]
      public CacheItemPriority Priority
      {
         get { return (CacheItemPriority)this["priority"]; }
         set { this["priority"] = value; }
      }

      /// <summary>
      /// Gets or sets the type of the expiration.
      /// </summary>
      /// <value>The type of the expiration.</value>
      [ConfigurationProperty("expirationType", IsRequired = false, DefaultValue = CacheExpirationType.Sliding)]
      public CacheExpirationType ExpirationType
      {
         get { return (CacheExpirationType)this["expirationType"]; }
         set { this["expirationType"] = value; }
      }

      /// <summary>
      /// Gets or sets the expiration minutes.
      /// </summary>
      /// <value>The expiration minutes.</value>
      [ConfigurationProperty("expirationMinutes", IsRequired = false, DefaultValue = 10)]
      public int ExpirationMinutes
      {
         get { return (int)this["expirationMinutes"]; }
         set { this["expirationMinutes"] = value; }
      }


      /// <summary>
      /// Gets or sets the number of seconds between modification checks.
      /// </summary>
      /// <value>The number of seconds between modification checks.</value>
      [ConfigurationProperty("secondsBetweenModificationChecks", IsRequired = false, DefaultValue = 60)]
      public int SecondsBetweenModificationChecks
      {
         get { return (int)this["secondsBetweenModificationChecks"]; }
         set { this["secondsBetweenModificationChecks"] = value; }
      }
   }
}
